//
//  QMessageCell.m
//  QoilPublic
//
//  Created by 杨凯 on 2017/7/10.
//  Copyright © 2017年 杨凯. All rights reserved.
//

#import "QMessageCell.h"
@interface QMessageCell ()
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *contentLab;
@property (weak, nonatomic) IBOutlet UILabel *timeLab;
@property (weak, nonatomic) IBOutlet UILabel *roundLab;

@end
@implementation QMessageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    _roundLab.layer.cornerRadius = 5;
    _roundLab.layer.masksToBounds = YES;
}

- (void)setModel:(QMessageModel *)model{
    _model = model;
    [_image sd_setImageWithURL:[NSURL URLWithString:_model.imgUrl] placeholderImage:[UIImage imageNamed:@"message_system"]];
    _titleLab.text = _model.ptName;
    _contentLab.text = _model.data;
    _timeLab.text =[[[_model.addTime componentsSeparatedByString:@" "] lastObject] substringWithRange:NSMakeRange(0, 5)];
    if ([_model.isLook isEqualToString:@"1"]) {
        _roundLab.hidden = NO;
    }else{
        _roundLab.hidden = YES;
    }
    
}

- (void)setListModel:(QMsgListModel *)listModel{
    _listModel = listModel;
    [_image sd_setImageWithURL:[NSURL URLWithString:_listModel.img] placeholderImage:[UIImage imageNamed:@"message_system"]];
    _titleLab.text = _listModel.title;
    _contentLab.text = _listModel.briefData;
    _timeLab.text =[[[_listModel.addTime componentsSeparatedByString:@" "] lastObject] substringWithRange:NSMakeRange(0, 5)];
    _roundLab.hidden = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
